<!-- 默认点赞列表 -->
<!Doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>点赞</title>
	<meta name="keywords" content="${keywords}"/>
	<meta name="description" content="${description}"/>
	<link rel="shortcut icon" type="image/x-icon" th:href="@{'/static/images/favicon.ico'}" media="screen" />
	<link th:href="@{'/static/css/common.css'}" type="text/css" rel="stylesheet" charset="utf-8">
	<link th:href="@{'/static/css/themify-icons/style.css'}" type="text/css" rel="stylesheet">
	<link th:href="@{'/static/js/layer/skin/default/layer.css'}" type="text/css" rel="stylesheet">
	<script language="javascript" th:src="@{'/static/js/tool.js'}" type="text/javascript"></script>
	<script language="javascript" th:src="@{'/static/js/ajax.js'}" type="text/javascript"></script>
	<script language="javascript" th:src="@{'/static/js/json2.js'}" type="text/javascript"></script>
	<script language="javascript" th:src="@{'/static/js/jquery/jquery.min.js'}" type="text/javascript"></script>
	<script language="javascript" th:src="@{'/static/js/layer/layer.js'}" type="text/javascript"></script>

</head>
<script type="text/javascript" language="javascript"> 

//删除点赞
function deleteLike(likeId){
	var parameter = "";//URI参数
	parameter += "likeId="+likeId;
	
	if(parameter.indexOf("&") == 0){
		parameter = parameter.substring(1,parameter.length);
	}
	
	post_request(function(value){
		if(value != ""){
			var returnValue = JSON.parse(value);//JSON转为对象
			for(var key in returnValue){
				if(key == "success"){	
					var success = returnValue[key];	
					if(success == "true"){
						layer.msg('删除点赞的话题成功,3秒后刷新页面', 
							{
							  time: 3000 //3秒关闭（如果不配置，默认是3秒）
							},function(){
								//关闭后的操作
					        	document.location.reload();//刷新页面
							}
						);
					}
				}else if(key == "error"){
					var errorValue = returnValue[key];
					var htmlValue = "";
					var i = 0;
					for(var error in errorValue){
						if(error != ""){	
							i++;
							htmlValue += "&nbsp;&nbsp;"+i+"、"+errorValue[error]+"<br>";
						}
					}
					
					layer.open({
					  type: 1,
					  title: '错误', 
					  skin: 'layui-layer-rim', //加上边框
					  area: ['300px', '150px'], //宽高
					  content: htmlValue
					});
					
				}
			}
		}
	},
		"like/delete?" +parameter, true);
}
</script>
<body>
<!-- 引入页头 -->
<div th:include="public/newPublic_2"></div>
<div class="skeleton ">
	<div class="main wrap backgroundModule" >

		<!-- 引入服务导航 -->
		<div th:include="public/newPublic_4"></div>
	
		<div class="dataTable">
			<TABLE class="dataList" width="100%">
				<THEAD>
					<TR class="dataThead">
						<TH width="50%">标题</TH>	
						<TH width="30%">点赞时间</TH>	
						<TH width="20%">操作</TH>
					</TR>
				</THEAD>
				<TBODY>
				<TR th:if="${resultList.size()>0 and resultList!=null}" th:each="result:${resultList}">
					<TD class="dataTD">
						<a th:href="@{'/forum?topicId='+${result.topicId}}" target="_blank" class="link" th:utext="${result.title}"></a>
					</TD>
					<TD class="dataTD" th:text="${#dates.format(result.createTime, 'yyyy-MM-dd HH:mm:ss')}">
					</TD>
					<TD class="dataTD">
						<a href="javascript:" th:onclick="deleteLike('[[${result.id}]]')">删除</a>
					</TD>
				</TR>

				<TR  th:if="${total==0}">
					<TD colSpan="3"  class="empty">还没有点赞话题</TD>
				</TR>
		    	</TBODY>
			</TABLE>
			<DIV class=pageList>
				<div th:include="public/newPublic_1"></div>
			</DIV>
		</div>

	</div>

</div>
<!--引入页脚-->
<div th:include="public/newPublic_3"></div>

</body>

</html>
